//
//  JSMDreamCityPrefectureTrailsArrayTableViewCell.m
//  TakeYouTourTogether
//
//  Created by king on 15/12/4.
//  Copyright © 2015年 king. All rights reserved.
//

#import "JSMDreamCityPrefectureTrailsArrayTableViewCell.h"

@implementation JSMDreamCityPrefectureTrailsArrayTableViewCell

#pragma mark - Method 自定义初始化方法
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createJSMDreamCityPrefectureTrailsArrayTableViewCell];
    }
    return self;
}
#pragma mark - Method 创建cell
- (void)createJSMDreamCityPrefectureTrailsArrayTableViewCell {
    self.detailLabel = [[BaseLabel alloc] init];
    self.detailLabel.backgroundColor = [UIColor clearColor];
    self.detailLabel.numberOfLines = 0;
    self.detailLabel.font = [UIFont systemFontOfSize:18];
    [self.detailLabel sizeToFit];
    [self.contentView addSubview:self.detailLabel];
}
#pragma mark - Method layoutSubviews
- (void)layoutSubviews {
    [super layoutSubviews];
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:19], NSFontAttributeName, nil];
    CGRect rect = [self.detailLabel.text boundingRectWithSize:CGSizeMake(SCREEN_WIDTH, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self).with.insets(UIEdgeInsetsMake(0, 5, 0, 5));
    }];
    [self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(self.contentView);
        make.centerX.equalTo(self.contentView);
        make.height.mas_equalTo(rect.size.height);
    }];
}

@end
